Skip to content

configuring copy_file_range: linking check instead of compiling - #22943

Open
fda77 wants to merge 1 commit into
php:masterfrom
fda77:patch-1
Open

configuring copy_file_range: linking check instead of compiling#22943
fda77 wants to merge 1 commit into
php:masterfrom
fda77:patch-1

Conversation

@fda77

@fda77 fda77 commented Jul 30, 2026

Copy link
Copy Markdown

For me compiling works but later linking not

@petk

petk commented Jul 30, 2026

Copy link
Copy Markdown
Member

Thanks for the PR. This is really weird. Usually, it's the other way around. Compilation works, but link step fails. 🤔 I'll check.

Does @devnexen perhaps know, why this happens?

@petk

petk commented Jul 30, 2026

Copy link
Copy Markdown
Member

@fda77 can you also please mention on which Linux distribution, this happens. Thanks.

From what I understand is, you mean, that the PHP build "works" with the linking test, which fails at the configure step. That would make more sense to me then.

@devnexen

Copy link
Copy Markdown
Member

for reference I had a look into the uclibc-ng repository. so copy_file_range is not guarded declaration-wise however the implementation is guarded by its syscall id presence.

@devnexen

Copy link
Copy Markdown
Member

it seems it misses a proper condition here. But we do need a workaround one way or another.

@fda77

fda77 commented Jul 30, 2026

Copy link
Copy Markdown
Author

PHP is used in https://github.com/Freetz-NG/freetz-ng/ , a firmware modification for Fritz!Box routers. It adds programs like PHP to the firmware. Kernel versions are 2.6 - 5, uclib 0.9 - latest uclibg-ng, gcc v4 - v13. These depend on what the device firmware uses. There are closed source kernelmodules and daemons, so kernel version etc could not changed.

I've run here a github action to test compile php on all devices, before that i deleted again the make/pkgs/php/patches/8.5/200-copy_file_range-check.patch which was the same like this PR: https://github.com/fda77/freetz-ng/actions/runs/30579727267

Problems only with some: arm + aarch64 + intel x86,
but not mips + mipsel +armeb
See action logs of

  • 5690: aarch64_gcc-13.4.0_uClibc-1.0.58-nptl_kernel-5.4
  • 7690: arm_gcc-13.4.0_uClibc-1.0.58-nptl_kernel-5.4
  • 6670: i686_gcc-13.4.0_uClibc-1.0.58-nptl_kernel-5.15
/__w/freetz-ng/freetz-ng/toolchain/build/aarch64_gcc-13.4.0_uClibc-1.0.58-nptl_kernel-5.4/aarch64-linux-uclibc/bin-ccache/../lib/gcc/aarch64-linux-uclibc/13.4.0/../../../../aarch64-linux-uclibc/bin/ld: main/streams/streams.o: in function `_php_stream_copy_to_stream_ex':
streams.c:(.text._php_stream_copy_to_stream_ex+0x2d4): undefined reference to `copy_file_range'

There is a newer action run with configure visible soon: https://github.com/fda77/freetz-ng/actions/runs/30581522530

2026-07-30T21:08:56.3680648Z checking for copy_filerange... yes

@devnexen

Copy link
Copy Markdown
Member

ah that reframes everything, I mistakenly looked at master but in your versions copy_file_range implementation did not exist yet..The split we see is not really arm versus mips but kernel headers ? Your PR them seems the right thing to do, wdyt @petk ?

@fda77

fda77 commented Jul 31, 2026

Copy link
Copy Markdown
Author

Yes, on my fork i remove the path / this pr again to get the error messages.
If there is a better way to fix copy_file_range problem do it, i'm not advanced with configure!

@petk petk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To not delay this PR for too long, then let's do this.

I'll recheck everything after it. Because, why I'm asking this... What I'm suspecting here is something else - that uclibc-ng is linked differently and that's why this issue. At the compile step (AC_COMPILE_IFELSE) the issue isn't present - header is available but the linking step isn't yet performed. And, from my current understanding is that there are more related issues then to this where Autoconf does only AC_COMPILE_IFELSE checks and similar without doing the linking step.

Nothing to worry for now. I'll get to this at some point once I set up this environment in my virtual machine or something. And I might have also misunderstood the issue in the first place and there are no other issues related to this.

When merging, let's merge this to PHP-8.4 and up then.

@fda77

fda77 commented Aug 11, 2026

Copy link
Copy Markdown
Author

In Freetz-NG the user could select the desired PHP version: 5.6, 8.2, 8.3 8.4 or 8.5
The patch "200-copy_file_range-check.patch" which is like this PR is used for 8.2-8.5 to be able to compile with uclibc-ng, see subdir of https://github.com/Freetz-NG/freetz-ng/tree/master/make/pkgs/php/patches
I dont know how PHP versions are still supported, but you could also backport it back to 8.2 if you like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants